//FormPanel 查询页面

Ext.DataSearchForm =  Ext.extend( Ext.form.FormPanel,{
	initialized:false,
	loadData:function(){
	this.store.load();
},
    initComponent:function(){
	this.labelAlign = 'right', //label右对齐，紧贴着文本框
	this.labelWidth = 100,
	this.title = '项目信息查询',
	this.url = 'dataManage/dataManageAction!conditionQuery'
	this.items = [{
		layout: 'Column',
		items: [{
			columnWidth:.7,
			xtype:'fieldset',
			checkboxToggle:true,
			title: '搜索条件',
			autoHeight:true,
			defaults: {width: 300},
			defaultType: 'textfield',
			items: [{
				xtype: 'textfield',
				fieldLabel: '项目编号',
				id:'projectNumber'
//			},{
//				xtype:"combo",
//				fieldLabel: '查询字段',
//				hiddenId: 'keyWordType',
//				id: 'keyWordType',
//				name: 'combo',
//				editable: false,
//				allowBlank: false,
//				blankText: '请选择查询字段！',
//				triggerAction: 'all', //query会使用autocomplete功能，会隐藏不匹配的信息
//				store: new Ext.data.SimpleStore({
//					fields:['keyWordType','text'],
//					data:[
//					      ['projectName','项目名称'],
//					      ['location','所在地'],
//					      ['mainUndertakeUnit','主承担单位'],
//					      ['guaranteeUnit','保证单位'],
//					      ['unitedUnitOne','联合单位'],
//					      ['mainManagingDepartment','主管处室'],
//					      ['followUpPerson','跟进人'],
//					      ['projectPlanCatagory','项目计划类别'],
//					      ['field','领域'],
//					     ]
//				}),
//				displayField: 'text',
//				valueField: 'keyWordType',
//				mode: 'local',
//				emptyText: '请选择',
			},{
				fieldLabel: '项目名称',
				id: 'projectName'
			},{
				fieldLabel: '所在地',
				id: 'location'
			},{
				fieldLabel: '主承办单位',
				id: 'mainUndertakeUnit'
			},{
				fieldLabel: '保证单位',
				id: 'guaranteeUnit'
			},{
				fieldLabel: '联合单位',
				id: 'unitedUnitOne'
			},{
				fieldLabel: '主管处室',
				id: 'mainManagingDepartment'
			},{
				fieldLabel: '跟进人',
				id: 'followUpPerson'
			},{
				fieldLabel: '项目负责人',
				id: 'projectDirector'
			},{
				fieldLabel: '项目计划类别',
				id: 'projectPlanCatagory'
			},{
				fieldLabel: '领域',
				id: 'field'
			},{
				xtype : 'fieldset',
                fieldLabel: '选择立项年度范围',
                title: '时间',
                collapsible : true,
                items: [{
				     xtype: 'datefield',
				     fieldLabel: '开始日期',
				     format : 'Y-m-d',
				     width: 150,
				     id:'contractBegin'
			    },{
				     xtype: 'datefield',
				     fieldLabel: '结束日期',
				     format : 'Y-m-d',
				     width: 150,
				     id:'contractEnd'
			    }]
			}],
	buttons: [{
		text: '查询',
		handler: function(action,form) {
         
		 var n = contentPanel.getComponent("searchResult");
			if (!n) { // //判断是否已经打开该面板
		n = contentPanel.add( 
				 new Ext.DataManageGrid({
					 	ds:new Ext.data.Store( {
							proxy : new Ext.data.HttpProxy( {
								url : 'dataManage/dataManageAction!conditionSelect'
							}),
							reader : projectManageReader,
							pageSize : 20}),
						id:'searchResult',
						loadMask:true,
						title:'搜索结果',
						closable:true,
						tbar:[{
							fieldLable:'搜索结果'
						}]
				 })
				 );
			}
			contentPanel.setActiveTab(n);
			n.getStore().load({
				url:'dataManage/dataManageAction!conditionSelect',
				params:{
				projectnumber: Ext.getCmp('projectNumber').getValue(),
				projectname: Ext.getCmp('projectName').getValue(),
				location: Ext.getCmp('location').getValue(),
				mainundertakeunit: Ext.getCmp('mainUndertakeUnit').getValue(),
				guaranteeunit: Ext.getCmp('guaranteeUnit').getValue(),
				unitedunitone: Ext.getCmp('unitedUnitOne').getValue(),
				mainmanagingdepartment: Ext.getCmp('mainManagingDepartment').getValue(), //主管处室
				followupperson: Ext.getCmp('followUpPerson').getValue(),
				projectdirector: Ext.getCmp('projectDirector').getValue(), //项目负责人
				projectplancatagory: Ext.getCmp('projectPlanCatagory').getValue(), //项目计划类别
				field: Ext.getCmp('field').getValue(),
				contractbegin: Ext.getCmp('contractBegin').getValue(),
				contractend: Ext.getCmp('contractEnd').getValue()
			}
			});
			
		
		
//		contentPanel.getComponent('search').getForm().submit({
//			url:'dataManage/dataManageAction!conditionQuery',
//			method:'post',
//
//		    success:function(form,action){
//				
//		},
//		    failure:function(form,action){
//			    Ext.Msg.alert('错误','操作失败!');
//		}
//		});
	}
            }]
}]
}];
	Ext.DataSearchForm.superclass.initComponent.call(this);
}
})

	
